package com.ckx.动物;

public class Test {
    public static void main6(String[] args) {
        //Object 是所有的父类
        Object object=new Dog("小黄",5);
    }
    public static void walk(IRunning iRunning){
        iRunning.run();
    }
    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }
    public static void flying(IFly iFly){
        iFly.fly();
    }

    public static void main5(String[] args) {
        walk(new Robot());//非动物类也可以
    }
    public static void main3(String[] args) {
        walk(new Dog("小黄",5));
        walk(new Duck("唐老鸭",2));
        flying(new Duck("唐老鸭",2));
    }
    //多态
    public static void main2(String[] args) {
        func(new Duck("唐老鸭",2));
        func(new Dog("AA",10));
        func(new Fish("BB",1));

    }
    public static void func(Animal animal){
        animal.eat();
    }
    public static void main(String[] args) {
        Dog dog1=new Dog("小黄",6);
//        dog1.run();
//        Animal animal=new Dog("小黄",6);
//        Dog dog3=(Dog) animal;
//        ((Dog) animal).swim();
        Dog dog2=new Dog("小黄",6);
        System.out.println(dog1.equals(dog2));
    }
}
